using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Runtime.Serialization;
using System.Collections;
using System.Data;
using System.ComponentModel;
using System.Data.OracleClient;
using WPFExcelReport.Helpers;
using WPFExcelReport.Controls;
namespace WPFExcelReport
{
    public partial class VWBDAT
    {
        public void SetUpNewRow(ref DataRow dwReturn)
        {

            switch (app.company)
            {
                case "YGR":
                case "TST":
                case "SXN":
                case "UBT":
                default:
                    #region=========
                    dwReturn["WBMANDANT"] = app.Mandant;
                    dwReturn["WBRWKRS"] = "  ";
                    dwReturn["WBRWLFD"] = "000000";
                    dwReturn["WBLESTKNR"] = "0000";
                    dwReturn["WBKUNDNR"] = "00000000";
                    dwReturn["WBWERK"] = "   ";
                    dwReturn["WBABT"] = "   ";
                    dwReturn["WBWAKZ"] = " ";
                    dwReturn["WBART"] = "                    ";
                    dwReturn["WBVAR"] = "  ";
                    dwReturn["WBDESS"] = "          ";
                    dwReturn["WBCOLORIT"] = "          ";
                    dwReturn["WBFARBE"] = "          ";
                    dwReturn["WBBESCHICH"] = "          ";
                    dwReturn["WBZUSTAND"] = "    ";
                    dwReturn["WBLIEFSCHNR"] = "1         ";
                    dwReturn["WBLIEFDAT"] = "0";
                    dwReturn["WBWEBER"] = "        ";
                    dwReturn["WBABS"] = "                              ";
                    dwReturn["WBEINDAT"] = "0";
                    dwReturn["WBEINLO"] = "  ";
                    dwReturn["WBKDPART"] = "  ";
                    dwReturn["WBSPSTA"] = "  ";
                    dwReturn["WBSPGRD"] = "  ";
                    dwReturn["WBSTK"] = "0";
                    dwReturn["WBMTR"] = "0";
                    dwReturn["WBGEBANZ"] = "0";
                    dwReturn["WBKGBRUT"] = "0";
                    dwReturn["WBKGNET"] = "0";
                    dwReturn["WBKGTARA"] = "0";
                    dwReturn["WBMEWE"] = "   ";
                    dwReturn["WBSTKK"] = "0";
                    dwReturn["WBMTRK"] = "0";
                    dwReturn["WBGEBANZK"] = "0";
                    dwReturn["WBKGNETK"] = "0";
                    dwReturn["WBRWAUFMSL"] = "  ";
                    dwReturn["WBGEBART"] = "    ";
                    dwReturn["WBBRT"] = "0";
                    dwReturn["WBGRQM"] = "0";
                    dwReturn["WBGRLFD"] = "0";
                    dwReturn["WBFDDIK"] = "0";
                    dwReturn["WBFDDIS"] = "0";
                    dwReturn["WBPRUEF"] = "        ";
                    dwReturn["WBSCHLIGR1"] = " ";
                    dwReturn["WBSCHLIGR2"] = " ";
                    dwReturn["WBSCHLIGR3"] = " ";
                    dwReturn["WBSCHLIGR4"] = " ";
                    dwReturn["WBSCHLIGR5"] = " ";
                    dwReturn["WBSCHLINR1"] = "   ";
                    dwReturn["WBSCHLINR2"] = "   ";
                    dwReturn["WBSCHLINR3"] = "   ";
                    dwReturn["WBSCHLINR4"] = "   ";
                    dwReturn["WBSCHLINR5"] = "   ";
                    dwReturn["WBFILLER1"] = " ";
                    dwReturn["WBSCHLIKZ"] = "J";
                    dwReturn["WBMATERIAL"] = "J";
                    dwReturn["WBKRITISCH"] = " ";
                    dwReturn["WBKDSTK"] = "J";
                    dwReturn["WBVERSRUE"] = " ";
                    dwReturn["WBKANTE"] = "  ";
                    dwReturn["WBENTKZ"] = " ";
                    dwReturn["WBBESTKZ"] = " ";
                    dwReturn["WBBESTKRS"] = "  ";
                    dwReturn["WBBESTLFD"] = "      ";
                    dwReturn["WBBESTPOS"] = "   ";
                    dwReturn["WBKOKRS"] = "  ";
                    dwReturn["WBKOLFD"] = "      ";
                    dwReturn["WBNETMTR"] = "0";
                    dwReturn["WBFERTKZ"] = "Z";
                    dwReturn["WBREDAT"] = "0";
                    dwReturn["WBRENR"] = "          ";
                    dwReturn["WBREWERT"] = "0";
                    dwReturn["WBSTAPO"] = "  ";
                    dwReturn["WBPLPREIS"] = "0";
                    dwReturn["WBEINVKZ"] = "E";
                    dwReturn["WBMATPRF"] = " ";
                    dwReturn["WBSPEDF"] = " ";
                    dwReturn["WBSPEDV"] = " ";
                    dwReturn["WBSPEDZ"] = " ";
                    dwReturn["WBURRENR"] = "          ";
                    dwReturn["WBURLAND"] = "CN ";
                    dwReturn["WBBUSIMODE"] = "   ";
                    dwReturn["WBDRVERT"] = "                    ";
                    dwReturn["WBCBOOKNO"] = "               ";
                    dwReturn["WBCITEMNO"] = "0";
                    dwReturn["WBZOLLST"] = "      ";
                    dwReturn["WBFILLER2"] = "                                              ";
                    dwReturn["WBAENDZL"] = "2";
                    dwReturn["WBAENDBEN"] = "        ";
                    dwReturn["WBAENDDAT"] = "0";
                    dwReturn["WBNEUBEN"] = "        ";
                    dwReturn["WBNEUDAT"] = "0";
                    #endregion
                    break;
                case "JLT":
                    #region
                    dwReturn["WBMANDANT"] = app.Mandant;
                    dwReturn["WBRWKRS"] = "  ";
                    dwReturn["WBRWLFD"] = "000000";
                    dwReturn["WBLESTKNR"] = "0000";
                    dwReturn["WBKUNDNR"] = "00000000";
                    dwReturn["WBWERK"] = "   ";
                    dwReturn["WBABT"] = "   ";
                    dwReturn["WBWAKZ"] = "F";
                    dwReturn["WBART"] = "                    ";
                    dwReturn["WBVAR"] = "  ";
                    dwReturn["WBDESS"] = "          ";
                    dwReturn["WBCOLORIT"] = "          ";
                    dwReturn["WBFARBE"] = "          ";
                    dwReturn["WBBESCHICH"] = "          ";
                    dwReturn["WBZUSTAND"] = "    ";
                    dwReturn["WBLIEFSCHNR"] = "          ";
                    dwReturn["WBLIEFDAT"] = "0";
                    dwReturn["WBWEBER"] = "        ";
                    dwReturn["WBABS"] = "                              ";
                    dwReturn["WBEINDAT"] = "0";
                    dwReturn["WBEINLO"] = "01";
                    dwReturn["WBKDPART"] = "          ";
                    dwReturn["WBSPSTA"] = "  ";
                    dwReturn["WBSPGRD"] = "  ";
                    dwReturn["WBSTK"] = "1";
                    dwReturn["WBMTR"] = "0";
                    dwReturn["WBGEBANZ"] = "0";
                    dwReturn["WBKGBRUT"] = "0";
                    dwReturn["WBKGNET"] = "0";
                    dwReturn["WBKGTARA"] = "0";
                    dwReturn["WBMEWE"] = "   ";
                    dwReturn["WBSTKK"] = "1";
                    dwReturn["WBMTRK"] = "0";
                    dwReturn["WBGEBANZK"] = "0";
                    dwReturn["WBKGNETK"] = "0";
                    dwReturn["WBRWAUFMSL"] = "  ";
                    dwReturn["WBGEBART"] = "    ";
                    dwReturn["WBBRT"] = "0";
                    dwReturn["WBGRQM"] = "0";
                    dwReturn["WBGRLFD"] = "0";
                    dwReturn["WBFDDIK"] = "0";
                    dwReturn["WBFDDIS"] = "0";
                    dwReturn["WBPRUEF"] = "WQJ     ";
                    dwReturn["WBSCHLIGR1"] = " ";
                    dwReturn["WBSCHLIGR2"] = " ";
                    dwReturn["WBSCHLIGR3"] = " ";
                    dwReturn["WBSCHLIGR4"] = " ";
                    dwReturn["WBSCHLIGR5"] = " ";
                    dwReturn["WBSCHLINR1"] = "000";
                    dwReturn["WBSCHLINR2"] = "000";
                    dwReturn["WBSCHLINR3"] = "000";
                    dwReturn["WBSCHLINR4"] = "000";
                    dwReturn["WBSCHLINR5"] = "000";
                    dwReturn["WBFILLER1"] = " ";
                    dwReturn["WBSCHLIKZ"] = "J";
                    dwReturn["WBMATERIAL"] = "J";
                    dwReturn["WBKRITISCH"] = " ";
                    dwReturn["WBKDSTK"] = "N";
                    dwReturn["WBVERSRUE"] = " ";
                    dwReturn["WBKANTE"] = "  ";
                    dwReturn["WBENTKZ"] = " ";
                    dwReturn["WBBESTKZ"] = " ";
                    dwReturn["WBBESTKRS"] = "  ";
                    dwReturn["WBBESTLFD"] = "      ";
                    dwReturn["WBBESTPOS"] = "   ";
                    dwReturn["WBKOKRS"] = "  ";
                    dwReturn["WBKOLFD"] = "      ";
                    dwReturn["WBNETMTR"] = "0";
                    dwReturn["WBFERTKZ"] = "Z";
                    dwReturn["WBREDAT"] = "0";
                    dwReturn["WBRENR"] = "          ";
                    dwReturn["WBREWERT"] = "0";
                    dwReturn["WBSTAPO"] = "  ";
                    dwReturn["WBPLPREIS"] = "0";
                    dwReturn["WBEINVKZ"] = "E";
                    dwReturn["WBMATPRF"] = " ";
                    dwReturn["WBSPEDF"] = " ";
                    dwReturn["WBSPEDV"] = " ";
                    dwReturn["WBSPEDZ"] = " ";
                    dwReturn["WBURRENR"] = "          ";
                    dwReturn["WBURLAND"] = "   ";
                    dwReturn["WBBUSIMODE"] = "   ";
                    dwReturn["WBDRVERT"] = "                    ";
                    dwReturn["WBCBOOKNO"] = "               ";
                    dwReturn["WBCITEMNO"] = "0";
                    dwReturn["WBZOLLST"] = "      ";
                    dwReturn["WBFILLER2"] = "                                              ";
                    dwReturn["WBAENDZL"] = "0";
                    dwReturn["WBAENDBEN"] = "        ";
                    dwReturn["WBAENDDAT"] = "0";
                    dwReturn["WBNEUBEN"] = "        ";
                    dwReturn["WBNEUDAT"] = "0";

                    #endregion
                    break;
            }
        }

        public void InsertWBDAT(DataRow dwData, string ITXDBVERSION = "50.24")
        {
            dwData["WBNEUBEN"] = app.User;
            dwData["WBNEUDAT"] = date;
            or1 = OracleDB.CreateCommand();
            switch (ITXDBVERSION)
            {
                default:
                case "UBT":
                case "TST":
                case "YCC":
                case "YGR":
                    or1.CommandText = "INSERT INTO WBDAT ( WBMANDANT,WBRWKRS,WBRWLFD,WBLESTKNR,WBKUNDNR,WBWERK,WBABT,WBWAKZ,WBART,WBVAR,WBDESS,WBCOLORIT,WBFARBE,WBBESCHICH,WBZUSTAND,WBLIEFSCHNR,WBLIEFDAT,WBWEBER,WBABS,WBEINDAT,WBEINLO,WBKDPART,WBSPSTA,WBSPGRD,WBSTK,WBMTR,WBGEBANZ,WBKGBRUT,WBKGNET,WBKGTARA,WBMEWE,WBSTKK,WBMTRK,WBGEBANZK,WBKGNETK,WBRWAUFMSL,WBGEBART,WBBRT,WBGRQM,WBGRLFD,WBFDDIK,WBFDDIS,WBPRUEF,WBSCHLIGR1,WBSCHLIGR2,WBSCHLIGR3,WBSCHLIGR4,WBSCHLIGR5,WBSCHLINR1,WBSCHLINR2,WBSCHLINR3,WBSCHLINR4,WBSCHLINR5,WBFILLER1,WBSCHLIKZ,WBMATERIAL,WBKRITISCH,WBKDSTK,WBVERSRUE,WBKANTE,WBENTKZ,WBBESTKZ,WBBESTKRS,WBBESTLFD,WBBESTPOS,WBKOKRS,WBKOLFD,WBNETMTR,WBFERTKZ,WBREDAT,WBRENR,WBREWERT,WBSTAPO,WBPLPREIS,WBEINVKZ,WBMATPRF,WBSPEDF,WBSPEDV,WBSPEDZ,WBURRENR,WBURLAND,WBBUSIMODE,WBDRVERT,WBCBOOKNO,WBCITEMNO,WBZOLLST,WBFILLER2,WBAENDZL,WBAENDBEN,WBAENDDAT,WBNEUBEN,WBNEUDAT)"
                        + " VALUES (:WBMANDANT:,:WBRWKRS:,:WBRWLFD:,:WBLESTKNR:,:WBKUNDNR:,:WBWERK:,:WBABT:,:WBWAKZ:,:WBART:,:WBVAR:,:WBDESS:,:WBCOLORIT:,:WBFARBE:,:WBBESCHICH:,:WBZUSTAND:,:WBLIEFSCHNR:,:WBLIEFDAT:,:WBWEBER:,:WBABS:,:WBEINDAT:,:WBEINLO:,:WBKDPART:,:WBSPSTA:,:WBSPGRD:,:WBSTK:,:WBMTR:,:WBGEBANZ:,:WBKGBRUT:,:WBKGNET:,:WBKGTARA:,:WBMEWE:,:WBSTKK:,:WBMTRK:,:WBGEBANZK:,:WBKGNETK:,:WBRWAUFMSL:,:WBGEBART:,:WBBRT:,:WBGRQM:,:WBGRLFD:,:WBFDDIK:,:WBFDDIS:,:WBPRUEF:,:WBSCHLIGR1:,:WBSCHLIGR2:,:WBSCHLIGR3:,:WBSCHLIGR4:,:WBSCHLIGR5:,:WBSCHLINR1:,:WBSCHLINR2:,:WBSCHLINR3:,:WBSCHLINR4:,:WBSCHLINR5:,:WBFILLER1:,:WBSCHLIKZ:,:WBMATERIAL:,:WBKRITISCH:,:WBKDSTK:,:WBVERSRUE:,:WBKANTE:,:WBENTKZ:,:WBBESTKZ:,:WBBESTKRS:,:WBBESTLFD:,:WBBESTPOS:,:WBKOKRS:,:WBKOLFD:,:WBNETMTR:,:WBFERTKZ:,:WBREDAT:,:WBRENR:,:WBREWERT:,:WBSTAPO:,:WBPLPREIS:,:WBEINVKZ:,:WBMATPRF:,:WBSPEDF:,:WBSPEDV:,:WBSPEDZ:,:WBURRENR:,:WBURLAND:,:WBBUSIMODE:,:WBDRVERT:,:WBCBOOKNO:,:WBCITEMNO:,:WBZOLLST:,:WBFILLER2:,:WBAENDZL:,:WBAENDBEN:,:WBAENDDAT:,:WBNEUBEN:,:WBNEUDAT:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case "JLT":
                    or1.CommandText = "INSERT INTO WBDAT ( WBMANDANT,WBRWKRS,WBRWLFD,WBLESTKNR,WBKUNDNR,WBWERK,WBABT,WBWAKZ,WBART,WBVAR,WBDESS,WBCOLORIT,WBFARBE,WBBESCHICH,WBZUSTAND,WBLIEFSCHNR,WBLIEFDAT,WBWEBER,WBABS,WBEINDAT,WBEINLO,WBKDPART,WBSPSTA,WBSPGRD,WBSTK,WBMTR,WBGEBANZ,WBKGBRUT,WBKGNET,WBKGTARA,WBMEWE,WBSTKK,WBMTRK,WBGEBANZK,WBKGNETK,WBRWAUFMSL,WBGEBART,WBBRT,WBGRQM,WBGRLFD,WBFDDIK,WBFDDIS,WBPRUEF,WBSCHLIGR1,WBSCHLIGR2,WBSCHLIGR3,WBSCHLIGR4,WBSCHLIGR5,WBSCHLINR1,WBSCHLINR2,WBSCHLINR3,WBSCHLINR4,WBSCHLINR5,WBFILLER1,WBSCHLIKZ,WBMATERIAL,WBKRITISCH,WBKDSTK,WBVERSRUE,WBKANTE,WBENTKZ,WBBESTKZ,WBBESTKRS,WBBESTLFD,WBBESTPOS,WBKOKRS,WBKOLFD,WBNETMTR,WBFERTKZ,WBREDAT,WBRENR,WBREWERT,WBSTAPO,WBPLPREIS,WBEINVKZ,WBMATPRF,WBSPEDF,WBSPEDV,WBSPEDZ,WBURRENR,WBURLAND,WBBUSIMODE,WBDRVERT,WBCBOOKNO,WBCITEMNO,WBZOLLST,WBFILLER2,WBAENDZL,WBAENDBEN,WBAENDDAT,WBNEUBEN,WBNEUDAT)"
                    + " VALUES (:WBMANDANT:,:WBRWKRS:,:WBRWLFD:,:WBLESTKNR:,:WBKUNDNR:,:WBWERK:,:WBABT:,:WBWAKZ:,:WBART:,:WBVAR:,:WBDESS:,:WBCOLORIT:,:WBFARBE:,:WBBESCHICH:,:WBZUSTAND:,:WBLIEFSCHNR:,:WBLIEFDAT:,:WBWEBER:,:WBABS:,:WBEINDAT:,:WBEINLO:,:WBKDPART:,:WBSPSTA:,:WBSPGRD:,:WBSTK:,:WBMTR:,:WBGEBANZ:,:WBKGBRUT:,:WBKGNET:,:WBKGTARA:,:WBMEWE:,:WBSTKK:,:WBMTRK:,:WBGEBANZK:,:WBKGNETK:,:WBRWAUFMSL:,:WBGEBART:,:WBBRT:,:WBGRQM:,:WBGRLFD:,:WBFDDIK:,:WBFDDIS:,:WBPRUEF:,:WBSCHLIGR1:,:WBSCHLIGR2:,:WBSCHLIGR3:,:WBSCHLIGR4:,:WBSCHLIGR5:,:WBSCHLINR1:,:WBSCHLINR2:,:WBSCHLINR3:,:WBSCHLINR4:,:WBSCHLINR5:,:WBFILLER1:,:WBSCHLIKZ:,:WBMATERIAL:,:WBKRITISCH:,:WBKDSTK:,:WBVERSRUE:,:WBKANTE:,:WBENTKZ:,:WBBESTKZ:,:WBBESTKRS:,:WBBESTLFD:,:WBBESTPOS:,:WBKOKRS:,:WBKOLFD:,:WBNETMTR:,:WBFERTKZ:,:WBREDAT:,:WBRENR:,:WBREWERT:,:WBSTAPO:,:WBPLPREIS:,:WBEINVKZ:,:WBMATPRF:,:WBSPEDF:,:WBSPEDV:,:WBSPEDZ:,:WBURRENR:,:WBURLAND:,:WBBUSIMODE:,:WBDRVERT:,:WBCBOOKNO:,:WBCITEMNO:,:WBZOLLST:,:WBFILLER2:,:WBAENDZL:,:WBAENDBEN:,:WBAENDDAT:,:WBNEUBEN:,:WBNEUDAT:)";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
            }

            Connect2Proxy(or1);
        }

        public DataSet QueryWBDAT(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "SELECT * FROM WBDAT WHERE  ROWNUM<2 ";
                    SResult = Connect2Proxy(or1);
                    break;
                case 1:
                    SResult = QWBDAT01(dwData);
                    break;
                case 2:
                    SResult = QWBDAT02(dwData);
                    break;
                case -2:
                    SResult = QWBDAT_2(dwData);
                    break;
                default:
                    break;
            }
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBDAT01(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM WBDAT WHERE WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBDAT02(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM WBDAT WHERE WBMANDANT=:WBMANDANT: AND WBBESTKZ=:WBBESTKZ: AND WBBESTKRS=:WBBESTKRS: AND WBBESTLFD=:WBBESTLFD: AND WBBESTPOS=:WBBESTPOS:";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public DataSet QWBDAT_2(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "SELECT * FROM WBDAT WHERE WBMANDANT=:WBMANDANT: "
                      + " AND WBEINDAT LIKE '%" + dwData["WBEINDAT"].ToString().Trim() + "%'"
                      + " AND WBEINLO LIKE '%" + dwData["WBEINLO"].ToString().Trim() + "%'"
                      + " AND WBART LIKE '%" + dwData["WBART"].ToString().Trim() + "%'"
                      + " AND WBVAR LIKE '%" + dwData["WBVAR"].ToString().Trim() + "%'"
                      + " AND WBFARBE LIKE '%" + dwData["WBFARBE"].ToString().Trim() + "%'"
                  + dwData["WBFILLER2"].ToString();
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            SResult = Connect2Proxy(or1);
            SResult.Tables[0].TableName = TableName;
            return SResult;
        }
        public void DeleteWBDAT(DataRow dwData, int option = 1)
        {
            or1 = OracleDB.CreateCommand();
            switch (option)
            {
                case 0:
                    or1.CommandText = "DELETE FROM WBDAT WHERE  WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                case 1:
                    or1.CommandText = "DELETE FROM WBDAT WHERE  WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD =:WBRWLFD: ";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    break;
                default:
                    break;
            }
            Connect2Proxy(or1);
        }
        public void DWBD00(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();

            or1.CommandText = "DELETE FROM WBDAT WHERE  WBMANDANT=:WBMANDANT:  ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);

            Connect2Proxy(or1);
        }

        public void UpdateWBDAT(DataRow dwData, string ITXDBVERSION = "50.24", int option = 1)
        {
            if (dwData != null)
            {
                dwData["WBAENDBEN"] = app.User;
                dwData["WBAENDDAT"] = date;
            }
            if (option == 0)
            {
                switch (app.company)
                {
                    default:
                    case "TST":
                    case "UBT":
                    case "SXN":
                    case "YGR":
                    case "YCC":
                        option = 2;
                        break;
                    case "JLT":
                        option = 3;
                        break;
                }
            }
           
            switch (option)
            {
                case 1:
                    or1 = OracleDB.CreateCommand();
                    #region====Command====
                    or1.CommandText = "UPDATE WBDAT SET "
                        + "WBMANDANT=:WBMANDANT:,"
                        + "WBRWKRS=:WBRWKRS:,"
                        + "WBRWLFD=:WBRWLFD:,"
                        + "WBLESTKNR=:WBLESTKNR:,"
                        + "WBKUNDNR=:WBKUNDNR:,"
                        + "WBWERK=:WBWERK:,"
                        + "WBABT=:WBABT:,"
                        + "WBWAKZ=:WBWAKZ:,"
                        + "WBART=:WBART:,"
                        + "WBVAR=:WBVAR:,"
                        + "WBDESS=:WBDESS:,"
                        + "WBCOLORIT=:WBCOLORIT:,"
                        + "WBFARBE=:WBFARBE:,"
                        + "WBBESCHICH=:WBBESCHICH:,"
                        + "WBZUSTAND=:WBZUSTAND:,"
                        + "WBLIEFSCHNR=:WBLIEFSCHNR:,"
                        + "WBLIEFDAT=:WBLIEFDAT:,"
                        + "WBWEBER=:WBWEBER:,"
                        + "WBABS=:WBABS:,"
                        + "WBEINDAT=:WBEINDAT:,"
                        + "WBEINLO=:WBEINLO:,"
                        + "WBKDPART=:WBKDPART:,"
                        + "WBSPSTA=:WBSPSTA:,"
                        + "WBSPGRD=:WBSPGRD:,"
                        + "WBSTK=:WBSTK:,"
                        + "WBMTR=:WBMTR:,"
                        + "WBGEBANZ=:WBGEBANZ:,"
                        + "WBKGBRUT=:WBKGBRUT:,"
                        + "WBKGNET=:WBKGNET:,"
                        + "WBKGTARA=:WBKGTARA:,"
                        + "WBMEWE=:WBMEWE:,"
                        + "WBSTKK=:WBSTKK:,"
                        + "WBMTRK=:WBMTRK:,"
                        + "WBGEBANZK=:WBGEBANZK:,"
                        + "WBKGNETK=:WBKGNETK:,"
                        + "WBRWAUFMSL=:WBRWAUFMSL:,"
                        + "WBGEBART=:WBGEBART:,"
                        + "WBBRT=:WBBRT:,"
                        + "WBGRQM=:WBGRQM:,"
                        + "WBGRLFD=:WBGRLFD:,"
                        + "WBFDDIK=:WBFDDIK:,"
                        + "WBFDDIS=:WBFDDIS:,"
                        + "WBPRUEF=:WBPRUEF:,"
                        + "WBSCHLIGR1=:WBSCHLIGR1:,"
                        + "WBSCHLIGR2=:WBSCHLIGR2:,"
                        + "WBSCHLIGR3=:WBSCHLIGR3:,"
                        + "WBSCHLIGR4=:WBSCHLIGR4:,"
                        + "WBSCHLIGR5=:WBSCHLIGR5:,"
                        + "WBSCHLINR1=:WBSCHLINR1:,"
                        + "WBSCHLINR2=:WBSCHLINR2:,"
                        + "WBSCHLINR3=:WBSCHLINR3:,"
                        + "WBSCHLINR4=:WBSCHLINR4:,"
                        + "WBSCHLINR5=:WBSCHLINR5:,"
                        + "WBFILLER1=:WBFILLER1:,"
                        + "WBSCHLIKZ=:WBSCHLIKZ:,"
                        + "WBMATERIAL=:WBMATERIAL:,"
                        + "WBKRITISCH=:WBKRITISCH:,"
                        + "WBKDSTK=:WBKDSTK:,"
                        + "WBVERSRUE=:WBVERSRUE:,"
                        + "WBKANTE=:WBKANTE:,"
                        + "WBENTKZ=:WBENTKZ:,"
                        + "WBBESTKZ=:WBBESTKZ:,"
                        + "WBBESTKRS=:WBBESTKRS:,"
                        + "WBBESTLFD=:WBBESTLFD:,"
                        + "WBBESTPOS=:WBBESTPOS:,"
                        + "WBKOKRS=:WBKOKRS:,"
                        + "WBKOLFD=:WBKOLFD:,"
                        + "WBNETMTR=:WBNETMTR:,"
                        + "WBFERTKZ=:WBFERTKZ:,"
                        + "WBREDAT=:WBREDAT:,"
                        + "WBRENR=:WBRENR:,"
                        + "WBREWERT=:WBREWERT:,"
                        + "WBSTAPO=:WBSTAPO:,"
                        + "WBPLPREIS=:WBPLPREIS:,"
                        + "WBEINVKZ=:WBEINVKZ:,"
                        + "WBMATPRF=:WBMATPRF:,"
                        + "WBSPEDF=:WBSPEDF:,"
                        + "WBSPEDV=:WBSPEDV:,"
                        + "WBSPEDZ=:WBSPEDZ:,"
                        + "WBURRENR=:WBURRENR:,"
                        + "WBURLAND=:WBURLAND:,"
                        + "WBBUSIMODE=:WBBUSIMODE:,"
                        + "WBDRVERT=:WBDRVERT:,"
                        + "WBCBOOKNO=:WBCBOOKNO:,"
                        + "WBCITEMNO=:WBCITEMNO:,"
                        + "WBZOLLST=:WBZOLLST:,"
                        + "WBFILLER2=:WBFILLER2:,"
                        + "WBAENDZL=:WBAENDZL:,"
                        + "WBAENDBEN=:WBAENDBEN:,"
                        + "WBAENDDAT=:WBAENDDAT: "
                       + " WHERE   WBMANDANT=:WBMANDANT AND WBRWKRS=:WBRWKRS AND WBRWLFD=:WBRWLFD";
                    #endregion
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 2:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE WBDAT SET WBMANDANT=:WBMANDANT:,WBRWKRS=:WBRWKRS:,WBRWLFD=:WBRWLFD:,WBLESTKNR=:WBLESTKNR:,WBKUNDNR=:WBKUNDNR:,WBWERK=:WBWERK:,WBABT=:WBABT:,WBWAKZ=:WBWAKZ:,WBART=:WBART:,WBVAR=:WBVAR:,WBDESS=:WBDESS:,WBCOLORIT=:WBCOLORIT:,WBFARBE=:WBFARBE:,WBBESCHICH=:WBBESCHICH:,WBZUSTAND=:WBZUSTAND:,WBLIEFSCHNR=:WBLIEFSCHNR:,WBLIEFDAT=:WBLIEFDAT:,WBWEBER=:WBWEBER:,WBABS=:WBABS:,WBEINDAT=:WBEINDAT:,WBEINLO=:WBEINLO:,WBKDPART=:WBKDPART:,WBSPSTA=:WBSPSTA:,WBSPGRD=:WBSPGRD:,WBSTK=:WBSTK:,WBMTR=:WBMTR:,WBGEBANZ=:WBGEBANZ:,WBKGBRUT=:WBKGBRUT:,WBKGNET=:WBKGNET:,WBKGTARA=:WBKGTARA:,WBMEWE=:WBMEWE:,WBSTKK=:WBSTKK:,WBMTRK=:WBMTRK:,WBGEBANZK=:WBGEBANZK:,WBKGNETK=:WBKGNETK:,WBRWAUFMSL=:WBRWAUFMSL:,WBGEBART=:WBGEBART:,WBBRT=:WBBRT:,WBGRQM=:WBGRQM:,WBGRLFD=:WBGRLFD:,WBFDDIK=:WBFDDIK:,WBFDDIS=:WBFDDIS:,WBPRUEF=:WBPRUEF:,WBSCHLIGR1=:WBSCHLIGR1:,WBSCHLIGR2=:WBSCHLIGR2:,WBSCHLIGR3=:WBSCHLIGR3:,WBSCHLIGR4=:WBSCHLIGR4:,WBSCHLIGR5=:WBSCHLIGR5:,WBSCHLINR1=:WBSCHLINR1:,WBSCHLINR2=:WBSCHLINR2:,WBSCHLINR3=:WBSCHLINR3:,WBSCHLINR4=:WBSCHLINR4:,WBSCHLINR5=:WBSCHLINR5:,WBFILLER1=:WBFILLER1:,WBSCHLIKZ=:WBSCHLIKZ:,WBMATERIAL=:WBMATERIAL:,WBKRITISCH=:WBKRITISCH:,WBKDSTK=:WBKDSTK:,WBVERSRUE=:WBVERSRUE:,WBKANTE=:WBKANTE:,WBENTKZ=:WBENTKZ:,WBBESTKZ=:WBBESTKZ:,WBBESTKRS=:WBBESTKRS:,WBBESTLFD=:WBBESTLFD:,WBBESTPOS=:WBBESTPOS:,WBKOKRS=:WBKOKRS:,WBKOLFD=:WBKOLFD:,WBNETMTR=:WBNETMTR:,WBFERTKZ=:WBFERTKZ:,WBREDAT=:WBREDAT:,WBRENR=:WBRENR:,WBREWERT=:WBREWERT:,WBSTAPO=:WBSTAPO:,WBPLPREIS=:WBPLPREIS:,WBEINVKZ=:WBEINVKZ:,WBMATPRF=:WBMATPRF:,WBSPEDF=:WBSPEDF:,WBSPEDV=:WBSPEDV:,WBSPEDZ=:WBSPEDZ:,WBURRENR=:WBURRENR:,WBURLAND=:WBURLAND:,WBBUSIMODE=:WBBUSIMODE:,WBDRVERT=:WBDRVERT:,WBCBOOKNO=:WBCBOOKNO:,WBCITEMNO=:WBCITEMNO:,WBZOLLST=:WBZOLLST:,WBFILLER2=:WBFILLER2:,WBAENDZL=:WBAENDZL:,WBAENDBEN=:WBAENDBEN:,WBAENDDAT=:WBAENDDAT:"
                        + " WHERE   WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 3:
                    or1 = OracleDB.CreateCommand();
                    or1.CommandText = "UPDATE WBDAT SET WBMANDANT=:WBMANDANT:,WBRWKRS=:WBRWKRS:,WBRWLFD=:WBRWLFD:,WBLESTKNR=:WBLESTKNR:,WBKUNDNR=:WBKUNDNR:,WBWERK=:WBWERK:,WBABT=:WBABT:,WBWAKZ=:WBWAKZ:,WBART=:WBART:,WBVAR=:WBVAR:,WBDESS=:WBDESS:,WBCOLORIT=:WBCOLORIT:,WBFARBE=:WBFARBE:,WBBESCHICH=:WBBESCHICH:,WBZUSTAND=:WBZUSTAND:,WBLIEFSCHNR=:WBLIEFSCHNR:,WBLIEFDAT=:WBLIEFDAT:,WBWEBER=:WBWEBER:,WBABS=:WBABS:,WBEINDAT=:WBEINDAT:,WBEINLO=:WBEINLO:,WBKDPART=:WBKDPART:,WBSPSTA=:WBSPSTA:,WBSPGRD=:WBSPGRD:,WBSTK=:WBSTK:,WBMTR=:WBMTR:,WBGEBANZ=:WBGEBANZ:,WBKGBRUT=:WBKGBRUT:,WBKGNET=:WBKGNET:,WBKGTARA=:WBKGTARA:,WBMEWE=:WBMEWE:,WBSTKK=:WBSTKK:,WBMTRK=:WBMTRK:,WBGEBANZK=:WBGEBANZK:,WBKGNETK=:WBKGNETK:,WBRWAUFMSL=:WBRWAUFMSL:,WBGEBART=:WBGEBART:,WBBRT=:WBBRT:,WBGRQM=:WBGRQM:,WBGRLFD=:WBGRLFD:,WBFDDIK=:WBFDDIK:,WBFDDIS=:WBFDDIS:,WBPRUEF=:WBPRUEF:,WBSCHLIGR1=:WBSCHLIGR1:,WBSCHLIGR2=:WBSCHLIGR2:,WBSCHLIGR3=:WBSCHLIGR3:,WBSCHLIGR4=:WBSCHLIGR4:,WBSCHLIGR5=:WBSCHLIGR5:,WBSCHLINR1=:WBSCHLINR1:,WBSCHLINR2=:WBSCHLINR2:,WBSCHLINR3=:WBSCHLINR3:,WBSCHLINR4=:WBSCHLINR4:,WBSCHLINR5=:WBSCHLINR5:,WBFILLER1=:WBFILLER1:,WBSCHLIKZ=:WBSCHLIKZ:,WBMATERIAL=:WBMATERIAL:,WBKRITISCH=:WBKRITISCH:,WBKDSTK=:WBKDSTK:,WBVERSRUE=:WBVERSRUE:,WBKANTE=:WBKANTE:,WBENTKZ=:WBENTKZ:,WBBESTKZ=:WBBESTKZ:,WBBESTKRS=:WBBESTKRS:,WBBESTLFD=:WBBESTLFD:,WBBESTPOS=:WBBESTPOS:,WBKOKRS=:WBKOKRS:,WBKOLFD=:WBKOLFD:,WBNETMTR=:WBNETMTR:,WBFERTKZ=:WBFERTKZ:,WBREDAT=:WBREDAT:,WBRENR=:WBRENR:,WBREWERT=:WBREWERT:,WBSTAPO=:WBSTAPO:,WBPLPREIS=:WBPLPREIS:,WBEINVKZ=:WBEINVKZ:,WBMATPRF=:WBMATPRF:,WBSPEDF=:WBSPEDF:,WBSPEDV=:WBSPEDV:,WBSPEDZ=:WBSPEDZ:,WBURRENR=:WBURRENR:,WBURLAND=:WBURLAND:,WBBUSIMODE=:WBBUSIMODE:,WBDRVERT=:WBDRVERT:,WBCBOOKNO=:WBCBOOKNO:,WBCITEMNO=:WBCITEMNO:,WBZOLLST=:WBZOLLST:,WBFILLER2=:WBFILLER2:,WBAENDZL=:WBAENDZL:,WBAENDBEN=:WBAENDBEN:,WBAENDDAT=:WBAENDDAT:,WBNEUBEN=:WBNEUBEN:,WBNEUDAT=:WBNEUDAT:"
                         + " WHERE   WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD:";
                    or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
                    Connect2Proxy(or1);
                    break;
                case 4:
                    UWBD04(dwData);
                    break;
                case 5:
                    UWBD05(dwData);
                    break;
            }
          
        }
        public void UWBD04(DataRow dwData) 
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE WBDAT SET (WBMTR,WBMTRK,WBNETMTR,WBKGNET,WBKGNETK,WBSTK,WBSTKK,WBLESTKNR)="
                      + " (SELECT 100*0.001*NVL(SUM(WBBSSTKLG),0),100*0.001*NVL(SUM(WBBSSTKLG),0),100*0.001*NVL(SUM(WBBSSTKLG),0),100*0.001*NVL(SUM(WBBSGEW),0),100*0.001*NVL(SUM(WBBSGEW),0),COUNT(*),COUNT(*),NVL(MAX(WBBPOS),0) FROM WBBST WHERE WBMANDANT=WBBMANDANT AND WBRWKRS=WBBRWKRS AND WBRWLFD=WBBRWLFD)"
                       + " WHERE   WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1);

        }
        public void UWBD05(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE WBDAT SET WBLESTKNR=:WBLESTKNR:"
                  + " WHERE   WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1); 
        }
        public void UWBDART(DataRow dwData)
        {
            or1 = OracleDB.CreateCommand();
            or1.CommandText = "UPDATE WBDAT SET WBART=:WBART:,WBVAR =:WBVAR:,WBDESS =:WBDESS:,WBCOLORIT =:WBCOLORIT:,WBFARBE =:WBFARBE:,WBBESCHICH =:WBBESCHICH:"
                  + " WHERE   WBMANDANT=:WBMANDANT: AND WBRWKRS=:WBRWKRS: AND WBRWLFD=:WBRWLFD: ";
            or1.CommandText = INTEXDBC.InjectData(or1.CommandText, dwData);
            Connect2Proxy(or1); 
        }
    }
}
